package com.havey.ye;

/**
 * @author huaiwei.com.havey.ye
 * @description 返利收费
 * @date 2021/2/9 17:25
 */
public class CashReturn extends CashSuper{

    private double moneyCondition=0d;
    private double moneyReturn=0d;

    public CashReturn(double moneyCondition, double moneyReturn) {
        this.moneyCondition = moneyCondition;
        this.moneyReturn = moneyReturn;
    }

    @Override
    public double acceptCash(double money) {
        double result=0;
        if(money>=moneyCondition){
            result=money-Math.floor(money/moneyCondition)*moneyReturn;
        }else{
            result=money;
        }
        return result;
    }
}
